
exist_keynote_list=["exist","quit","q","Q"]
def check_is_exist(keynote):
    if keynote in exist_keynote_list:
        return True
    else:
        return False

def print_dic(dic):
    for key, val in dic.items():
        print(f"{key.title()}:{val.title()}")

def print_list(lists):
    for element in lists:
        print(element)


print("test1---->")

def disp_msg():
    print("We learn python function")

disp_msg()


print("\ntest2---->")

def favorite_book(title):
    print("One of my favorite books is " + title + ".")

favorite_book("SanGuoYanYi")


print("\ntest3---->")
def make_shirt(size, logo):
    print("Your shirt size is " + size + ";" + \
            " your shirt logo is " + logo + ".")

make_shirt("S", "Hello world")
make_shirt(logo="404", size="L")

print("\ntest4---->")
def make_shirt_new(size, logo="'I love python'"):
    print("Your shirt size is " + size + ";" + \
            " your shirt logo is " + logo + ".")

make_shirt_new("XL")
make_shirt_new("M")
make_shirt_new("S", "'I love Riscv'")


print("\ntest5---->")
def describe_city(city, country="China"):
    print(f"{city} is belong {country}!")

describe_city("Taiwan")
describe_city("Beijing")
describe_city("NewYork", "USA")

print("\ntest6---->")
def describe_city_new(city, country="China"):
    des = city + "," +country
    return des
des = describe_city_new("guilin", "china")
print(des.title())


print("\ntest7---->")
def make_album(singers, album, num=""):
    info={"singers_name":singers, "album_name":album, "sing_num":num}
    return info

album_info=make_album("jielun", "yequ", "10")
print_dic(album_info)

print("\ntest8---->")
singer_prompt="Please enter the singer's name:\n"
album_prompt="Please enter the aibum's name:\n"
album_info_new={}
active=True
while(active):
    singer=input(singer_prompt)
    if check_is_exist(singer) == True:
        break

    album=input(album_prompt)
    if check_is_exist(album) == True:
        break
    album_info_new=make_album(singer, album)

print_dic(album_info_new)

print("\ntest9---->")
magicians=["David Copperfield", "Derren Brown", "Criss Angel"]
def show_magicians(list_name):
    print_list(list_name)

show_magicians(magicians)


print("\ntest10---->")
def make_great(list_name):
    for i in range(len(list_name)):
        list_name[i] = "the Great " + list_name[i]

make_great(magicians)
show_magicians(magicians)



print("\ntest11---->")
magicians_new=['Harry', 'David', 'Alice']
def make_great_new(list_name):
    for i in range(len(list_name)):
        list_name[i] = "the Great " + list_name[i]
    return list_name

great_magicians = make_great_new(magicians_new[:])
show_magicians(great_magicians)
print("\nOriginal:")
show_magicians(magicians_new)

print("\ntest12---->")
def make_sandwich(*toppings):
    print_list(toppings)

make_sandwich("chicken", "beef")
make_sandwich("chicken", "beef","egg","tuna" )

print("\ntest13---->")
def make_profile(fname, lname,**info):
    user_info={}
    user_info["fname"]=fname
    user_info["lname"]=lname
    for key,val in info.items():
        user_info[key]=val
    return user_info

user_info = make_profile("ma","lp",location="sh",hometown="dy")
print_dic(user_info)


print("\ntest14---->")
def make_car_profile(mfacturer, series, **info):
    car_info={}
    car_info["manufacturer"]=mfacturer
    car_info["series"]=series
    for key,val in info.items():
        car_info[key]=val
    return car_info

car_info = make_car_profile("tesla","model y",color="back",power="800v")
print_dic(car_info)

